package main;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;

/**
 * The Location class is responsible for saving data for a location as well as drawing itself onto the canvas.
 *
 * @author Adrian Cieluch
 * @author Patrick Bauer
 */
public class Location extends Point {
    private int id;
    private int width = 5, height = 5;
    private Color color = Color.blue;
    
    /**
     * Sets the location.
     * 
     * @param x     x value of the position
     * @param y     y value of the position
     * @param id    id of the location
     */
    public Location(int x, int y, int id) {
        super(x, y);
        this.id = id;
    }
    
    /**
     * Sets the color for the point.
     * 
     * @param color the color of the point
     */
    public void setColor(Color color) {
        this.color = color;
    }
    
    /**
     * Returns the id.
     * 
     * @return id
     */
    public int getID() {
        return this.id;
    }
    
    /**
     * Draws the point and name.
     * 
     * @param g graphics context
     */
    public void draw(Graphics g) {
        g.setColor(this.color);
        g.fillRect(this.x, this.y, this.width, this.height);
        
        g.setColor(Color.black);
        g.drawString("Ort "+this.id, x-10, y+15);
    }
}
